﻿<controls:ChildWindow x:Class="LEEAAttendanceControl.Views.ShiftEdit"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="400" Height="560">
    <Grid x:Name="LayoutRoot" Margin="2" DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <sdk:TabControl Grid.Row="0" VerticalAlignment="Top">
            <sdk:TabItem Header="Shift">
                <Grid Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="130"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <sdk:Label Grid.Column="0" Grid.Row="0" Content="Shift ID: " VerticalAlignment="Center" Margin="3"
                       HorizontalAlignment="Left"/>

                    <TextBox x:Name="ShiftIDBox" Width="150" Grid.Column="1" Grid.Row="0" IsEnabled="False"
                     Background="#FFD4E515" Margin="3"
                     Text="{Binding Path=ShiftID, Mode=TwoWay, ValidatesOnExceptions=True,NotifyOnValidationError=True}"/>

                    <sdk:Label Grid.Column="0" Grid.Row="1" Content="Company ID:" VerticalAlignment="Center" Margin="3"
                               HorizontalAlignment="Left"/>

                    <ComboBox x:Name="CompanyIdBox" Width="150" Grid.Column="1" Grid.Row="1" Margin="3"
                              DisplayMemberPath="CompanyName" SelectedValuePath="ID" Height="25"
                              SelectedValue="{Binding CompanyID, Mode=TwoWay, ValidatesOnExceptions=True
                              , NotifyOnValidationError=True}"/>

                    <sdk:Label Grid.Column="0" Grid.Row="2" Content="Shift Name: " VerticalAlignment="Center" Margin="3"
                       HorizontalAlignment="Left"/>

                    <TextBox x:Name="ShiftNameBox" Width="150" Grid.Column="1" Grid.Row="2" Margin="3"
                     Text="{Binding Path=ShiftName, Mode=TwoWay, ValidatesOnExceptions=True,NotifyOnValidationError=True}" />

                    <sdk:Label Grid.Column="0" Grid.Row="3" Content="Apply From: " VerticalAlignment="Center" Margin="3"
                       HorizontalAlignment="Left"/>

                    <sdk:DatePicker x:Name="FromPicker" Grid.Column="1" Grid.Row="3" Width="150" Margin="3"
                            SelectedDate="{Binding Path=DateFrom, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>

                    <sdk:Label Grid.Column="0" Grid.Row="4" Margin="3" Content="Time From: " VerticalAlignment="Center"
                       HorizontalAlignment="Left"/>

                    <toolkit:TimePicker x:Name="TimeFromPicker" Grid.Column="1" Grid.Row="4" Margin="3" Width="150"
                                Value="{Binding Path=TimeFrom, Mode=TwoWay, ValidatesOnExceptions=True
                                , NotifyOnValidationError=True}" HorizontalContentAlignment="Left"/>

                    <sdk:Label Grid.Column="0" Grid.Row="5" Content="Time To: " Margin="3" VerticalAlignment="Center"
                       HorizontalAlignment="Left"/>

                    <toolkit:TimePicker x:Name="TimeToPicker" Grid.Column="1" Grid.Row="5" Width="150"
                                Value="{Binding Path=TimeTo, Mode=TwoWay, ValidatesOnExceptions=True
                                , NotifyOnValidationError=True}" HorizontalContentAlignment="Left"/>

                    <sdk:Label Grid.Column="0" Grid.Row="6" Margin="3" Content="Color: " VerticalAlignment="Center"
                       HorizontalAlignment="Left"/>

                    <ComboBox x:Name="ColorBox" Grid.Column="1" Grid.Row="6" Width="150" Margin="3" Height="25"
                              SelectedValuePath="ColorName" SelectionChanged="ColorBox_SelectionChanged">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <Border BorderBrush="#304041" BorderThickness="1">
                                    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                                        <Rectangle Width="120" Height="23" Stroke="{Binding ColorName}"
                                               Fill="{Binding ColorName}"/>
                                    </StackPanel>
                                </Border>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                    <!--
                    <TextBox x:Name="ColorBox" Grid.Column="1" Grid.Row="6" Margin="3" Width="150"
                             Text="{Binding Path=Color, Mode=TwoWay, ValidatesOnExceptions=True, TargetNullValue=''
                        , NotifyOnValidationError=True}"/>
                    -->

                    <sdk:Label Grid.Column="0" Grid.Row="7" Content="Weekly Time: " Margin="3" VerticalAlignment="Center"
                       HorizontalAlignment="Left"/>

                    <toolkit:NumericUpDown x:Name="WeeklyHoursUD" Grid.Column="1" Grid.Row="7" Width="150" Margin="3"
                                           Background="White" Foreground="Black" DecimalPlaces="0" Increment="1"
                                           Value="{Binding Path=WeeklyTime, Mode=TwoWay, ValidatesOnExceptions=True
                                           , NotifyOnValidationError=True}" HorizontalContentAlignment="Left"/>

                    <sdk:Label Grid.Column="0" Grid.Row="8" Margin="3" Content="Break Time: " HorizontalAlignment="Left"
                               VerticalAlignment="Center"/>

                    <TextBox Grid.Column="1" Grid.Row="8" Margin="3" Width="150"
                             Text="{Binding Path=BreakTime, Mode=TwoWay, ValidatesOnExceptions=True, TargetNullValue=''
                             , NotifyOnValidationError=True}"/>

                    <sdk:Label Grid.Column="0" Grid.Row="9" Margin="3" Content="Min Break Deduction:"
                               VerticalAlignment="Center" HorizontalAlignment="Left"/>

                    <toolkit:NumericUpDown x:Name="MinDeductionUD" Grid.Column="1" Grid.Row="9" Margin="3" Width="150"
                                           DecimalPlaces="0" HorizontalContentAlignment="Left" Background="White"
                                           Value="{Binding Path=MinBreakDeduction, Mode=TwoWay, ValidatesOnExceptions=True
                                           , NotifyOnValidationError=True}" Increment="1"/>
                </Grid>
            </sdk:TabItem>
            <sdk:TabItem x:Name="RulesTab" Header="Rounding Rules">
                <Grid HorizontalAlignment="Center" Margin="10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <sdk:Label Grid.Column="0" Grid.Row="0" Margin="3" Content="Shift Pratitions In: "
                               HorizontalAlignment="Left" VerticalAlignment="Center"/>

                    <toolkit:NumericUpDown x:Name="PartitionsUD" Grid.Column="1" Grid.Row="0" Width="120" Margin="3"
                                           HorizontalContentAlignment="Left" Background="White" Increment="1"
                                           DecimalPlaces="0" Value="{Binding Path=FirstPeriodIN, Mode=TwoWay
                                           , ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>

                    <TextBlock Grid.Column="0" Grid.Row="1" Margin="3,15,3,3" TextWrapping="Wrap" Width="200"
                               Text="Punch IN rounds to beginning time of an interval if less than:"/>

                    <toolkit:NumericUpDown x:Name="RoundingINUD" Grid.Column="1" Grid.Row="1" Width="120" Margin="3"
                                           DecimalPlaces="0" Value="{Binding Path=RountingTimeIN, Mode=TwoWay
                                           , ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>

                    <TextBlock Grid.Column="0" Grid.Row="2" Margin="3,10,3,3" TextWrapping="Wrap" Width="200"
                               Text="Punch OUT rounds to beginning time of an interval if less than:"/>

                    <toolkit:NumericUpDown x:Name="RoundingOUTUD" Grid.Column="1" Grid.Row="2" Width="120" Margin="3"
                                           DecimalPlaces="0" Value="{Binding Path=RountingTimeOUT, Mode=TwoWay
                                           , ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>

                    <TextBlock Grid.Column="0" Grid.Row="3" Margin="3,15,3,3" TextWrapping="Wrap" Width="200"
                               Text="Punch IN will be registered within Shift i it will take place less than:"/>

                    <toolkit:NumericUpDown x:Name="GraceINUD" Grid.Column="1" Grid.Row="3" Width="120" Margin="3"
                                           DecimalPlaces="0" Value="{Binding Path=GraceIN, Mode=TwoWay
                                           , ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>

                    <TextBlock Grid.Column="0" Grid.Row="4" Margin="3,10,3,3" TextWrapping="Wrap" Width="200"
                               Text="Punch OUT will be registered within Shift i it will take place less than:"/>

                    <toolkit:NumericUpDown x:Name="GraceOUTUD" Grid.Column="1" Grid.Row="4" Width="120" Margin="3"
                                           DecimalPlaces="0" Value="{Binding Path=GraceOUT, Mode=TwoWay
                                           , ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>
                </Grid>
            </sdk:TabItem>
        </sdk:TabControl>

        <Button x:Name="SaveButton" Content="Save" Grid.Row="1" Width="50" Height="25" Margin="282,6,46,14"
                Click="SaveButton_Click"/>

        <sdk:ValidationSummary x:Name="ErrorsSummary" Margin="0,13,0,2" Grid.Row="2" Height="120"/>
    </Grid>
</controls:ChildWindow>